﻿using Microsoft.Xna.Framework;
using MoreEvent.Content.Projectiles;
using Terraria;
using Terraria.ModLoader;

namespace MoreEvent.Common.Players
{
    public class AccPlayer : ModPlayer
    {
        public bool LegendaryFamilyMeal;
        public override void ResetEffects()
        {
            LegendaryFamilyMeal = false;
        }
        public override void UpdateDead()
        {
            LegendaryFamilyMeal = false;
        }
        public override void PostUpdate()
        {
            if (LegendaryFamilyMeal)
            {
                if (Player.ownedProjectileCounts[ModContent.ProjectileType<FrenchFrie>()] < 8)
                {
                    int friesNeeded = 8 - Player.ownedProjectileCounts[ModContent.ProjectileType<FrenchFrie>()];
                    for (int i = 0; i < friesNeeded; i++)
                    {
                        Projectile.NewProjectile(Player.GetSource_Accessory(null), Player.Center, Vector2.Zero, ModContent.ProjectileType<FrenchFrie>(), 20, 1f, Player.whoAmI);
                    }
                }
                if (Player.ownedProjectileCounts[ModContent.ProjectileType<FrenchFrie2>()] < 8)
                {
                    int friesNeeded = 8 - Player.ownedProjectileCounts[ModContent.ProjectileType<FrenchFrie2>()];
                    for (int i = 0; i < friesNeeded; i++)
                    {
                        Projectile.NewProjectile(Player.GetSource_Accessory(null), Player.Center, Vector2.Zero, ModContent.ProjectileType<FrenchFrie2>(), 25, 1.2f, Player.whoAmI);
                    }
                }
                if (Player.ownedProjectileCounts[ModContent.ProjectileType<HotChickenLeg>()] < 4)
                {
                    int chickensNeeded = 4 - Player.ownedProjectileCounts[ModContent.ProjectileType<HotChickenLeg>()];
                    for (int i = 0; i < chickensNeeded; i++)
                    {
                        Projectile.NewProjectile(Player.GetSource_Accessory(null), Player.Center, Vector2.Zero, ModContent.ProjectileType<HotChickenLeg>(), 30, 2f, Player.whoAmI);
                    }
                }
            }
        }       
    }
}
